
#include "util.h"
#include "dex-structs.h"
#include "dex-types.h"
#include "encoded-value.h"
#include "dex-class.h"
#include "dex-annotation.h"
#include "dex-string.h"
#include "dex-method.h"


//number of elements in the array
unsigned int CDexEncodedArray::GetSize()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//"a series of size encoded_value byte sequences in the format specified by this section, concatenated sequentially."
CDexEncodedValue* CDexEncodedArray::GetValues()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//size

	    return (CDexEncodedValue*)p;
}
				
void CDexEncodedArray::print()
{
	char * p=&dummy;
	printf("Size:");
	((CDexUleb128 *)p)->print();//size
	p+=((CDexUleb128 *)p)->Size();
	printf("Values:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexEncodedValue *)p)->print();
		p+=((CDexEncodedValue *)p)->Size();
	}

}
				
int CDexEncodedArray::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Values:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedValue *)p)->sprint(buffer+len);
		p+=((CDexEncodedValue *)p)->Size();
	}

	return len;
}
				
int CDexEncodedArray::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//size
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedValue *)p)->Size();
		p+=((CDexEncodedValue *)p)->Size();
	}

	return len;
}
//type of the annotation. This must be a class (not array or primitive) type.
unsigned int CDexEncodedAnnotation::GetTypeIdx()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//number of name-value mappings in this annotation
unsigned int CDexEncodedAnnotation::GetSize()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//type_idx

	    return ((CDexUleb128*)p)->to_int();
}
//elements of the annotataion, represented directly in-line (not as offsets). Elements must be sorted in increasing order by string_id index.
CDexAnnotationElement* CDexEncodedAnnotation::GetElements()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//type_idx
		p+=((CDexUleb128 *)p)->Size();//size

	    return (CDexAnnotationElement*)p;
}
				
void CDexEncodedAnnotation::print()
{
	char * p=&dummy;
	printf("Type idx:");
	((CDexUleb128 *)p)->print();//type_idx
	p+=((CDexUleb128 *)p)->Size();
	printf("Size:");
	((CDexUleb128 *)p)->print();//size
	p+=((CDexUleb128 *)p)->Size();
	printf("Elements:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexAnnotationElement *)p)->print();
		p+=((CDexAnnotationElement *)p)->Size();
	}

}
				
int CDexEncodedAnnotation::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Type idx:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//type_idx
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Elements:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationElement *)p)->sprint(buffer+len);
		p+=((CDexAnnotationElement *)p)->Size();
	}

	return len;
}
				
int CDexEncodedAnnotation::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//type_idx
	len+=((CDexUleb128 *)p)->Size();//size
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationElement *)p)->Size();
		p+=((CDexAnnotationElement *)p)->Size();
	}

	return len;
}
//element name, represented as an index into the string_ids section. The string must conform to the syntax for MemberName, defined above.
unsigned int CDexAnnotationElement::GetNameIdx()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//element value
CDexEncodedValue* CDexAnnotationElement::GetValue()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//name_idx

	    return (CDexEncodedValue*)p;
}
				
void CDexAnnotationElement::print()
{
	char * p=&dummy;
	printf("Name idx:");
	((CDexUleb128 *)p)->print();//name_idx
	p+=((CDexUleb128 *)p)->Size();
	printf("Value:");
	((CDexEncodedValue *)p)->print();//value

}
				
int CDexAnnotationElement::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Name idx:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//name_idx
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Value:");
	len+=((CDexEncodedValue *)p)->sprint(buffer+len);//value

	return len;
}
				
int CDexAnnotationElement::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//name_idx
	len+=((CDexEncodedValue *)p)->Size();//value

	return len;
}
				
void CDexHeaderItem::print()
{
	printf("\nMagic:");
	print_mem32((char*)magic,0,8);
	printf("\nChecksum:%08x",checksum);
	printf("\nSignature:");
	print_mem32((char*)signature,0,20);
	printf("\nFile size:%08x",file_size);
	printf("\nHeader size:%08x",header_size);
	printf("\nEndian tag:%08x",endian_tag);
	printf("\nLink size:%08x",link_size);
	printf("\nLink off:%08x",link_off);
	printf("\nMap off:%08x",map_off);
	printf("\nString ids size:%08x",string_ids_size);
	printf("\nString ids off:%08x",string_ids_off);
	printf("\nType ids size:%08x",type_ids_size);
	printf("\nType ids off:%08x",type_ids_off);
	printf("\nProto ids size:%08x",proto_ids_size);
	printf("\nProto ids off:%08x",proto_ids_off);
	printf("\nField ids size:%08x",field_ids_size);
	printf("\nField ids off:%08x",field_ids_off);
	printf("\nMethod ids size:%08x",method_ids_size);
	printf("\nMethod ids off:%08x",method_ids_off);
	printf("\nClass defs size:%08x",class_defs_size);
	printf("\nClass defs off:%08x",class_defs_off);
	printf("\nData size:%08x",data_size);
	printf("\nData off:%08x",data_off);

}
				
int CDexHeaderItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Magic:");
	print_mem32((char*)magic,0,8);
	len+=sprintf(buffer+len,"Checksum:%08x",checksum);
	len+=sprintf(buffer+len,"Signature:");
	print_mem32((char*)signature,0,20);
	len+=sprintf(buffer+len,"File size:%08x",file_size);
	len+=sprintf(buffer+len,"Header size:%08x",header_size);
	len+=sprintf(buffer+len,"Endian tag:%08x",endian_tag);
	len+=sprintf(buffer+len,"Link size:%08x",link_size);
	len+=sprintf(buffer+len,"Link off:%08x",link_off);
	len+=sprintf(buffer+len,"Map off:%08x",map_off);
	len+=sprintf(buffer+len,"String ids size:%08x",string_ids_size);
	len+=sprintf(buffer+len,"String ids off:%08x",string_ids_off);
	len+=sprintf(buffer+len,"Type ids size:%08x",type_ids_size);
	len+=sprintf(buffer+len,"Type ids off:%08x",type_ids_off);
	len+=sprintf(buffer+len,"Proto ids size:%08x",proto_ids_size);
	len+=sprintf(buffer+len,"Proto ids off:%08x",proto_ids_off);
	len+=sprintf(buffer+len,"Field ids size:%08x",field_ids_size);
	len+=sprintf(buffer+len,"Field ids off:%08x",field_ids_off);
	len+=sprintf(buffer+len,"Method ids size:%08x",method_ids_size);
	len+=sprintf(buffer+len,"Method ids off:%08x",method_ids_off);
	len+=sprintf(buffer+len,"Class defs size:%08x",class_defs_size);
	len+=sprintf(buffer+len,"Class defs off:%08x",class_defs_off);
	len+=sprintf(buffer+len,"Data size:%08x",data_size);
	len+=sprintf(buffer+len,"Data off:%08x",data_off);

	return len;
}
				
int CDexHeaderItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//elements of the list
CDexMapItem* CDexMapList::GetList()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexMapItem*)p;
}
				
void CDexMapList::print()
{
	printf("\nSize:%08x",size);
	char * p=(char*)(this+1);
	printf("List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexMapItem *)p)->print();
		p+=((CDexMapItem *)p)->Size();
	}

}
				
int CDexMapList::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Size:%08x",size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexMapItem *)p)->sprint(buffer+len);
		p+=((CDexMapItem *)p)->Size();
	}

	return len;
}
				
int CDexMapList::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexMapItem *)p)->Size();
		p+=((CDexMapItem *)p)->Size();
	}

	return len;
}
				
void CDexMapItem::print()
{
	printf("\nType:%04x",type);
	printf("\nUnused:%04x",unused);
	printf("\nSize:%08x",size);
	printf("\nOffset:%08x",offset);

}
				
int CDexMapItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Type:%04x",type);
	len+=sprintf(buffer+len,"Unused:%04x",unused);
	len+=sprintf(buffer+len,"Size:%08x",size);
	len+=sprintf(buffer+len,"Offset:%08x",offset);

	return len;
}
				
int CDexMapItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexStringidItem::print()
{
	printf("\nString data off:%08x",string_data_off);

}
				
int CDexStringidItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"String data off:%08x",string_data_off);

	return len;
}
				
int CDexStringidItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//size of this string, in UTF-16 code units (which is the "string length" in many systems). That is, this is the decoded length of the string. (The encoded length is implied by the position of the 0 byte.)
unsigned int CDexStringdataItem::GetUtf16Size()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//a series of MUTF-8 code units (a.k.a. octets, a.k.a. bytes) followed by a byte of value 0. See "MUTF-8 (Modified UTF-8) Encoding" above for details and discussion about the data format.
ubyte* CDexStringdataItem::GetData()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//utf16_size

	    return ((ubyte*)p);
}
				
void CDexStringdataItem::print()
{
	char * p=&dummy;
	printf("Utf16 size:");
	((CDexUleb128 *)p)->print();//utf16_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Data:");
	int _utf16_size=GetUtf16Size();
	print_mem32(p,0,_utf16_size);

}
				
int CDexStringdataItem::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Utf16 size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//utf16_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Data:");
	int _utf16_size=GetUtf16Size();
	len+=sprint_mem32(buffer+len,0,p,_utf16_size);

	return len;
}
				
int CDexStringdataItem::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//utf16_size
	int _utf16_size=GetUtf16Size();
	for(int i=0;i<_utf16_size;i++){
		len+=((CDexUbyte *)p)->Size();
		p+=((CDexUbyte *)p)->Size();
	}

	return len;
}
				
void CDexTypeidItem::print()
{
	printf("\nDescriptor idx:%08x",descriptor_idx);

}
				
int CDexTypeidItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Descriptor idx:%08x",descriptor_idx);

	return len;
}
				
int CDexTypeidItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexProtoidItem::print()
{
	printf("\nShorty idx:%08x",shorty_idx);
	printf("\nReturn type idx:%08x",return_type_idx);
	printf("\nParameters off:%08x",parameters_off);

}
				
int CDexProtoidItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Shorty idx:%08x",shorty_idx);
	len+=sprintf(buffer+len,"Return type idx:%08x",return_type_idx);
	len+=sprintf(buffer+len,"Parameters off:%08x",parameters_off);

	return len;
}
				
int CDexProtoidItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexFieldidItem::print()
{
	printf("\nClass idx:%04x",class_idx);
	printf("\nType idx:%04x",type_idx);
	printf("\nName idx:%08x",name_idx);

}
				
int CDexFieldidItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Class idx:%04x",class_idx);
	len+=sprintf(buffer+len,"Type idx:%04x",type_idx);
	len+=sprintf(buffer+len,"Name idx:%08x",name_idx);

	return len;
}
				
int CDexFieldidItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexMethodidItem::print()
{
	printf("\nClass idx:%04x",class_idx);
	printf("\nProto idx:%04x",proto_idx);
	printf("\nName idx:%08x",name_idx);

}
				
int CDexMethodidItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Class idx:%04x",class_idx);
	len+=sprintf(buffer+len,"Proto idx:%04x",proto_idx);
	len+=sprintf(buffer+len,"Name idx:%08x",name_idx);

	return len;
}
				
int CDexMethodidItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexClassdefItem::print()
{
	printf("\nClass idx:%08x",class_idx);
	printf("\nAccess flags:%08x",access_flags);
	printf("\nSuperclass idx:%08x",superclass_idx);
	printf("\nInterfaces off:%08x",interfaces_off);
	printf("\nSource file idx:%08x",source_file_idx);
	printf("\nAnnotations off:%08x",annotations_off);
	printf("\nClass data off:%08x",class_data_off);
	printf("\nStatic values off:%08x",static_values_off);

}
				
int CDexClassdefItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Class idx:%08x",class_idx);
	len+=sprintf(buffer+len,"Access flags:%08x",access_flags);
	len+=sprintf(buffer+len,"Superclass idx:%08x",superclass_idx);
	len+=sprintf(buffer+len,"Interfaces off:%08x",interfaces_off);
	len+=sprintf(buffer+len,"Source file idx:%08x",source_file_idx);
	len+=sprintf(buffer+len,"Annotations off:%08x",annotations_off);
	len+=sprintf(buffer+len,"Class data off:%08x",class_data_off);
	len+=sprintf(buffer+len,"Static values off:%08x",static_values_off);

	return len;
}
				
int CDexClassdefItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//the number of static fields defined in this item
unsigned int CDexClassdataItem::GetStaticfieldsSize()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//the number of instance fields defined in this item
unsigned int CDexClassdataItem::GetInstancefieldsSize()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size

	    return ((CDexUleb128*)p)->to_int();
}
//the number of direct methods defined in this item
unsigned int CDexClassdataItem::GetDirectmethodsSize()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size

	    return ((CDexUleb128*)p)->to_int();
}
//the number of virtual methods defined in this item
unsigned int CDexClassdataItem::GetVirtualmethodsSize()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size
		p+=((CDexUleb128 *)p)->Size();//direct_methods_size

	    return ((CDexUleb128*)p)->to_int();
}
//the defined static fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
CDexEncodedField* CDexClassdataItem::GetStaticFields()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size
		p+=((CDexUleb128 *)p)->Size();//direct_methods_size
		p+=((CDexUleb128 *)p)->Size();//virtual_methods_size

	    return (CDexEncodedField*)p;
}
//the defined instance fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order.
CDexEncodedField* CDexClassdataItem::GetInstanceFields()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size
		p+=((CDexUleb128 *)p)->Size();//direct_methods_size
		p+=((CDexUleb128 *)p)->Size();//virtual_methods_size
		p+=((CDexEncodedField *)p)->Size();//static_fields

	    return (CDexEncodedField*)p;
}
//the defined direct (any of static, private, or constructor) methods, represented as a sequence of encoded elements. The methods must be sorted by method_idx in increasing order.
CDexEncodedMethod* CDexClassdataItem::GetDirectMethods()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size
		p+=((CDexUleb128 *)p)->Size();//direct_methods_size
		p+=((CDexUleb128 *)p)->Size();//virtual_methods_size
		p+=((CDexEncodedField *)p)->Size();//static_fields
		p+=((CDexEncodedField *)p)->Size();//instance_fields

	    return (CDexEncodedMethod*)p;
}
//the defined virtual (none of static, private, or constructor) methods, represented as a sequence of encoded elements. This list should not include inherited methods unless overridden by the class that this item represents. The methods must be sorted by method_idx in increasing order.
CDexEncodedMethod* CDexClassdataItem::GetVirtualMethods()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//static_fields_size
		p+=((CDexUleb128 *)p)->Size();//instance_fields_size
		p+=((CDexUleb128 *)p)->Size();//direct_methods_size
		p+=((CDexUleb128 *)p)->Size();//virtual_methods_size
		p+=((CDexEncodedField *)p)->Size();//static_fields
		p+=((CDexEncodedField *)p)->Size();//instance_fields
		p+=((CDexEncodedMethod *)p)->Size();//direct_methods

	    return (CDexEncodedMethod*)p;
}
				
void CDexClassdataItem::print()
{
	char * p=&dummy;
	printf("Static fields size:");
	((CDexUleb128 *)p)->print();//static_fields_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Instance fields size:");
	((CDexUleb128 *)p)->print();//instance_fields_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Direct methods size:");
	((CDexUleb128 *)p)->print();//direct_methods_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Virtual methods size:");
	((CDexUleb128 *)p)->print();//virtual_methods_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Static fields:");
	int _static_fields_size=GetStaticfieldsSize();
	for(int i=0;i<_static_fields_size;i++){
		((CDexEncodedField *)p)->print();
		p+=((CDexEncodedField *)p)->Size();
	}
	printf("Instance fields:");
	int _instance_fields_size=GetInstancefieldsSize();
	for(int i=0;i<_instance_fields_size;i++){
		((CDexEncodedField *)p)->print();
		p+=((CDexEncodedField *)p)->Size();
	}
	printf("Direct methods:");
	int _direct_methods_size=GetDirectmethodsSize();
	for(int i=0;i<_direct_methods_size;i++){
		((CDexEncodedMethod *)p)->print();
		p+=((CDexEncodedMethod *)p)->Size();
	}
	printf("Virtual methods:");
	int _virtual_methods_size=GetVirtualmethodsSize();
	for(int i=0;i<_virtual_methods_size;i++){
		((CDexEncodedMethod *)p)->print();
		p+=((CDexEncodedMethod *)p)->Size();
	}

}
				
int CDexClassdataItem::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Static fields size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//static_fields_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Instance fields size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//instance_fields_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Direct methods size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//direct_methods_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Virtual methods size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//virtual_methods_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Static fields:");
	int _static_fields_size=GetStaticfieldsSize();
	for(int i=0;i<_static_fields_size;i++){
		len+=((CDexEncodedField *)p)->sprint(buffer+len);
		p+=((CDexEncodedField *)p)->Size();
	}
	len+=sprintf(buffer+len,"Instance fields:");
	int _instance_fields_size=GetInstancefieldsSize();
	for(int i=0;i<_instance_fields_size;i++){
		len+=((CDexEncodedField *)p)->sprint(buffer+len);
		p+=((CDexEncodedField *)p)->Size();
	}
	len+=sprintf(buffer+len,"Direct methods:");
	int _direct_methods_size=GetDirectmethodsSize();
	for(int i=0;i<_direct_methods_size;i++){
		len+=((CDexEncodedMethod *)p)->sprint(buffer+len);
		p+=((CDexEncodedMethod *)p)->Size();
	}
	len+=sprintf(buffer+len,"Virtual methods:");
	int _virtual_methods_size=GetVirtualmethodsSize();
	for(int i=0;i<_virtual_methods_size;i++){
		len+=((CDexEncodedMethod *)p)->sprint(buffer+len);
		p+=((CDexEncodedMethod *)p)->Size();
	}

	return len;
}
				
int CDexClassdataItem::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//static_fields_size
	len+=((CDexUleb128 *)p)->Size();//instance_fields_size
	len+=((CDexUleb128 *)p)->Size();//direct_methods_size
	len+=((CDexUleb128 *)p)->Size();//virtual_methods_size
	int _static_fields_size=GetStaticfieldsSize();
	for(int i=0;i<_static_fields_size;i++){
		len+=((CDexEncodedField *)p)->Size();
		p+=((CDexEncodedField *)p)->Size();
	}
	int _instance_fields_size=GetInstancefieldsSize();
	for(int i=0;i<_instance_fields_size;i++){
		len+=((CDexEncodedField *)p)->Size();
		p+=((CDexEncodedField *)p)->Size();
	}
	int _direct_methods_size=GetDirectmethodsSize();
	for(int i=0;i<_direct_methods_size;i++){
		len+=((CDexEncodedMethod *)p)->Size();
		p+=((CDexEncodedMethod *)p)->Size();
	}
	int _virtual_methods_size=GetVirtualmethodsSize();
	for(int i=0;i<_virtual_methods_size;i++){
		len+=((CDexEncodedMethod *)p)->Size();
		p+=((CDexEncodedMethod *)p)->Size();
	}

	return len;
}
//index into the field_ids list for the identity of this field (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
unsigned int CDexEncodedField::GetFieldidxDiff()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//access flags for the field (public, final, etc.). See "access_flags Definitions" for details.
unsigned int CDexEncodedField::GetAccessFlags()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//field_idx_diff

	    return ((CDexUleb128*)p)->to_int();
}
				
void CDexEncodedField::print()
{
	char * p=&dummy;
	printf("Field idx diff:");
	((CDexUleb128 *)p)->print();//field_idx_diff
	p+=((CDexUleb128 *)p)->Size();
	printf("Access flags:");
	((CDexUleb128 *)p)->print();//access_flags

}
				
int CDexEncodedField::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Field idx diff:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//field_idx_diff
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Access flags:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//access_flags

	return len;
}
				
int CDexEncodedField::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//field_idx_diff
	len+=((CDexUleb128 *)p)->Size();//access_flags

	return len;
}
//index into the method_ids list for the identity of this method (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly.
unsigned int CDexEncodedMethod::GetMethodidxDiff()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//access flags for the method (public, final, etc.). See "access_flags Definitions" for details.
unsigned int CDexEncodedMethod::GetAccessFlags()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//method_idx_diff

	    return ((CDexUleb128*)p)->to_int();
}
//offset from the start of the file to the code structure for this method, or 0 if this method is either abstract or native. The offset should be to a location in the data section. The format of the data is specified by "code_item" below.
unsigned int CDexEncodedMethod::GetCodeOff()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//method_idx_diff
		p+=((CDexUleb128 *)p)->Size();//access_flags

	    return ((CDexUleb128*)p)->to_int();
}
				
void CDexEncodedMethod::print()
{
	char * p=&dummy;
	printf("Method idx diff:");
	((CDexUleb128 *)p)->print();//method_idx_diff
	p+=((CDexUleb128 *)p)->Size();
	printf("Access flags:");
	((CDexUleb128 *)p)->print();//access_flags
	p+=((CDexUleb128 *)p)->Size();
	printf("Code off:");
	((CDexUleb128 *)p)->print();//code_off

}
				
int CDexEncodedMethod::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Method idx diff:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//method_idx_diff
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Access flags:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//access_flags
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Code off:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//code_off

	return len;
}
				
int CDexEncodedMethod::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//method_idx_diff
	len+=((CDexUleb128 *)p)->Size();//access_flags
	len+=((CDexUleb128 *)p)->Size();//code_off

	return len;
}
//elements of the list
CDexTypeItem* CDexTypeList::GetList()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexTypeItem*)p;
}
				
void CDexTypeList::print()
{
	printf("\nSize:%08x",size);
	char * p=(char*)(this+1);
	printf("List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexTypeItem *)p)->print();
		p+=((CDexTypeItem *)p)->Size();
	}

}
				
int CDexTypeList::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Size:%08x",size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexTypeItem *)p)->sprint(buffer+len);
		p+=((CDexTypeItem *)p)->Size();
	}

	return len;
}
				
int CDexTypeList::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexTypeItem *)p)->Size();
		p+=((CDexTypeItem *)p)->Size();
	}

	return len;
}
				
void CDexTypeItem::print()
{
	printf("\nType idx:%04x",type_idx);

}
				
int CDexTypeItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Type idx:%04x",type_idx);

	return len;
}
				
int CDexTypeItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//actual array of bytecode. The format of code in an insns array is specified by the companion document "Bytecode for the Dalvik VM". Note that though this is defined as an array of ushort, there are some internal structures that prefer four-byte alignment. Also, if this happens to be in an endian-swapped file, then the swapping is only done on individual ushorts and not on the larger internal structures.
ushort* CDexCodeItem::GetInsns()

{
	      char*p=(char*)(this+1);      	
	

	    return ((ushort*)p);
}
//two bytes of padding to make tries four-byte aligned. This element is only present if tries_size is non-zero and insns_size is odd.((optional) = 0)
ushort CDexCodeItem::GetPadding()

{
	      char*p=(char*)(this+1);      	
	
		p+=((CDexUshort *)p)->Size();//insns

	    return ((CDexUshort*)p)->value;
}
//array indicating where in the code exceptions are caught and how to handle them. Elements of the array must be non-overlapping in range and in order from low to high address. This element is only present if tries_size is non-zero.((optional))
CDexTryItem* CDexCodeItem::GetTries()

{
	      char*p=(char*)(this+1);      	
	
		p+=((CDexUshort *)p)->Size();//insns
		p+=((CDexUshort *)p)->Size();//padding

	    return (CDexTryItem*)p;
}
//bytes representing a list of lists of catch types and associated handler addresses. Each try_item has a byte-wise offset into this structure. This element is only present if tries_size is non-zero.((optional))
CDexEncodedcatchhandlerList* CDexCodeItem::GetHandlers()

{
	      char*p=(char*)(this+1);      	
	
		p+=((CDexUshort *)p)->Size();//insns
		p+=((CDexUshort *)p)->Size();//padding
		p+=((CDexTryItem *)p)->Size();//tries

	    return (CDexEncodedcatchhandlerList*)p;
}
				
void CDexCodeItem::print()
{
	printf("\nRegisters size:%04x",registers_size);
	printf("\nIns size:%04x",ins_size);
	printf("\nOuts size:%04x",outs_size);
	printf("\nTries size:%04x",tries_size);
	printf("\nDebug info off:%08x",debug_info_off);
	printf("\nInsns size:%08x",insns_size);
	char * p=(char*)(this+1);
	printf("Insns:");
	int _insns_size=GetInsnsSize();
	for(int i=0;i<_insns_size;i++){
		((CDexUshort *)p)->print();
		p+=((CDexUshort *)p)->Size();
	}
	printf("Padding:");
	((CDexUshort *)p)->print();//padding
	p+=((CDexUshort *)p)->Size();
	printf("Tries:");
	int _tries_size=GetTriesSize();
	for(int i=0;i<_tries_size;i++){
		((CDexTryItem *)p)->print();
		p+=((CDexTryItem *)p)->Size();
	}
	printf("Handlers:");
	((CDexEncodedcatchhandlerList *)p)->print();//handlers

}
				
int CDexCodeItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Registers size:%04x",registers_size);
	len+=sprintf(buffer+len,"Ins size:%04x",ins_size);
	len+=sprintf(buffer+len,"Outs size:%04x",outs_size);
	len+=sprintf(buffer+len,"Tries size:%04x",tries_size);
	len+=sprintf(buffer+len,"Debug info off:%08x",debug_info_off);
	len+=sprintf(buffer+len,"Insns size:%08x",insns_size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"Insns:");
	int _insns_size=GetInsnsSize();
	for(int i=0;i<_insns_size;i++){
		len+=((CDexUshort *)p)->sprint(buffer+len);
		p+=((CDexUshort *)p)->Size();
	}
	len+=sprintf(buffer+len,"Padding:");
	len+=((CDexUshort *)p)->sprint(buffer+len);//padding
	p+=((CDexUshort *)p)->Size();
	len+=sprintf(buffer+len,"Tries:");
	int _tries_size=GetTriesSize();
	for(int i=0;i<_tries_size;i++){
		len+=((CDexTryItem *)p)->sprint(buffer+len);
		p+=((CDexTryItem *)p)->Size();
	}
	len+=sprintf(buffer+len,"Handlers:");
	len+=((CDexEncodedcatchhandlerList *)p)->sprint(buffer+len);//handlers

	return len;
}
				
int CDexCodeItem::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _insns_size=GetInsnsSize();
	for(int i=0;i<_insns_size;i++){
		len+=((CDexUshort *)p)->Size();
		p+=((CDexUshort *)p)->Size();
	}
	len+=((CDexUshort *)p)->Size();//padding
	int _tries_size=GetTriesSize();
	for(int i=0;i<_tries_size;i++){
		len+=((CDexTryItem *)p)->Size();
		p+=((CDexTryItem *)p)->Size();
	}
	len+=((CDexEncodedcatchhandlerList *)p)->Size();//handlers

	return len;
}
				
void CDexTryItem::print()
{
	printf("\nStart addr:%08x",start_addr);
	printf("\nInsn count:%04x",insn_count);
	printf("\nHandler off:%04x",handler_off);

}
				
int CDexTryItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Start addr:%08x",start_addr);
	len+=sprintf(buffer+len,"Insn count:%04x",insn_count);
	len+=sprintf(buffer+len,"Handler off:%04x",handler_off);

	return len;
}
				
int CDexTryItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//size of this list, in entries
unsigned int CDexEncodedcatchhandlerList::GetSize()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//actual list of handler lists, represented directly (not as offsets), and concatenated sequentially
CDexEncodedcatchHandler* CDexEncodedcatchhandlerList::GetList()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//size

	    return (CDexEncodedcatchHandler*)p;
}
				
void CDexEncodedcatchhandlerList::print()
{
	char * p=&dummy;
	printf("Size:");
	((CDexUleb128 *)p)->print();//size
	p+=((CDexUleb128 *)p)->Size();
	printf("List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexEncodedcatchHandler *)p)->print();
		p+=((CDexEncodedcatchHandler *)p)->Size();
	}

}
				
int CDexEncodedcatchhandlerList::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedcatchHandler *)p)->sprint(buffer+len);
		p+=((CDexEncodedcatchHandler *)p)->Size();
	}

	return len;
}
				
int CDexEncodedcatchhandlerList::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//size
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedcatchHandler *)p)->Size();
		p+=((CDexEncodedcatchHandler *)p)->Size();
	}

	return len;
}
//number of catch types in this list. If non-positive, then this is the negative of the number of catch types, and the catches are followed by a catch-all handler. For example: A size of 0 means that there is a catch-all but no explicitly typed catches. A size of 2 means that there are two explicitly typed catches and no catch-all. And a size of -1 means that there is one typed catch along with a catch-all.
int CDexEncodedcatchHandler::GetSize()

{
	      char*p=&dummy;      	
	

	    return ((CDexSleb128*)p)->to_int();
}
//stream of abs(size) encoded items, one for each caught type, in the order that the types should be tested.
CDexEncodedtypeaddrPair* CDexEncodedcatchHandler::GetHandlers()

{
	      char*p=&dummy;      	
	
		p+=((CDexSleb128 *)p)->Size();//size

	    return (CDexEncodedtypeaddrPair*)p;
}
//bytecode address of the catch-all handler. This element is only present if size is non-positive.((optional))
unsigned int CDexEncodedcatchHandler::GetCatchallAddr()

{
	      char*p=&dummy;      	
	
		p+=((CDexSleb128 *)p)->Size();//size
		p+=((CDexEncodedtypeaddrPair *)p)->Size();//handlers

	    return ((CDexUleb128*)p)->to_int();
}
				
void CDexEncodedcatchHandler::print()
{
	char * p=&dummy;
	printf("Size:");
	((CDexSleb128 *)p)->print();//size
	p+=((CDexSleb128 *)p)->Size();
	printf("Handlers:");
	int _size=GetSize();
	if(_size<0) {_size=-_size;}
	for(int i=0;i<_size;i++){
		((CDexEncodedtypeaddrPair *)p)->print();
		p+=((CDexEncodedtypeaddrPair *)p)->Size();
	}
	printf("Catch all addr:");
	((CDexUleb128 *)p)->print();//catch_all_addr

}
				
int CDexEncodedcatchHandler::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Size:");
	len+=((CDexSleb128 *)p)->sprint(buffer+len);//size
	p+=((CDexSleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Handlers:");
	int _size=GetSize();
	if(_size<0) {_size=-_size;}
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedtypeaddrPair *)p)->sprint(buffer+len);
		p+=((CDexEncodedtypeaddrPair *)p)->Size();
	}
	len+=sprintf(buffer+len,"Catch all addr:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//catch_all_addr

	return len;
}
				
int CDexEncodedcatchHandler::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexSleb128 *)p)->Size();//size
	int _size=GetSize();
	if(_size<0) {_size=-_size;}
	for(int i=0;i<_size;i++){
		len+=((CDexEncodedtypeaddrPair *)p)->Size();
		p+=((CDexEncodedtypeaddrPair *)p)->Size();
	}
	len+=((CDexUleb128 *)p)->Size();//catch_all_addr

	return len;
}
//index into the type_ids list for the type of the exception to catch
unsigned int CDexEncodedtypeaddrPair::GetTypeIdx()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//bytecode address of the associated exception handler
unsigned int CDexEncodedtypeaddrPair::GetAddr()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//type_idx

	    return ((CDexUleb128*)p)->to_int();
}
				
void CDexEncodedtypeaddrPair::print()
{
	char * p=&dummy;
	printf("Type idx:");
	((CDexUleb128 *)p)->print();//type_idx
	p+=((CDexUleb128 *)p)->Size();
	printf("Addr:");
	((CDexUleb128 *)p)->print();//addr

}
				
int CDexEncodedtypeaddrPair::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Type idx:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//type_idx
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Addr:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//addr

	return len;
}
				
int CDexEncodedtypeaddrPair::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//type_idx
	len+=((CDexUleb128 *)p)->Size();//addr

	return len;
}
//the initial value for the state machine's line register. Does not represent an actual positions entry.
unsigned int CDexDebuginfoitemHeader::GetLineStart()

{
	      char*p=&dummy;      	
	

	    return ((CDexUleb128*)p)->to_int();
}
//the number of parameter names that are encoded. There should be one per method parameter, excluding an instance method's this, if any.
unsigned int CDexDebuginfoitemHeader::GetParametersSize()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//line_start

	    return ((CDexUleb128*)p)->to_int();
}
//string index of the method parameter name. An encoded value of NO_INDEX indicates that no name is available for the associated parameter. The type descriptor and signature are implied from the method descriptor and signature.
int* CDexDebuginfoitemHeader::GetParameterNames()

{
	      char*p=&dummy;      	
	
		p+=((CDexUleb128 *)p)->Size();//line_start
		p+=((CDexUleb128 *)p)->Size();//parameters_size

	    return ((int*)p);
}
				
void CDexDebuginfoitemHeader::print()
{
	char * p=&dummy;
	printf("Line start:");
	((CDexUleb128 *)p)->print();//line_start
	p+=((CDexUleb128 *)p)->Size();
	printf("Parameters size:");
	((CDexUleb128 *)p)->print();//parameters_size
	p+=((CDexUleb128 *)p)->Size();
	printf("Parameter names:");
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		((CDexUleb128p1 *)p)->print();
		p+=((CDexUleb128p1 *)p)->Size();
	}

}
				
int CDexDebuginfoitemHeader::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Line start:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//line_start
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Parameters size:");
	len+=((CDexUleb128 *)p)->sprint(buffer+len);//parameters_size
	p+=((CDexUleb128 *)p)->Size();
	len+=sprintf(buffer+len,"Parameter names:");
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		len+=((CDexUleb128p1 *)p)->sprint(buffer+len);
		p+=((CDexUleb128p1 *)p)->Size();
	}

	return len;
}
				
int CDexDebuginfoitemHeader::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexUleb128 *)p)->Size();//line_start
	len+=((CDexUleb128 *)p)->Size();//parameters_size
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		len+=((CDexUleb128p1 *)p)->Size();
		p+=((CDexUleb128p1 *)p)->Size();
	}

	return len;
}
//list of associated field annotations. The elements of the list must be sorted in increasing order, by field_idx.((optional))
CDexFieldAnnotation* CDexAnnotationsdirectoryItem::GetFieldAnnotations()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexFieldAnnotation*)p;
}
//list of associated method annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
CDexMethodAnnotation* CDexAnnotationsdirectoryItem::GetMethodAnnotations()

{
	      char*p=(char*)(this+1);      	
	
		p+=((CDexFieldAnnotation *)p)->Size();//field_annotations

	    return (CDexMethodAnnotation*)p;
}
//list of associated method parameter annotations. The elements of the list must be sorted in increasing order, by method_idx.((optional))
CDexParameterAnnotation* CDexAnnotationsdirectoryItem::GetParameterAnnotations()

{
	      char*p=(char*)(this+1);      	
	
		p+=((CDexFieldAnnotation *)p)->Size();//field_annotations
		p+=((CDexMethodAnnotation *)p)->Size();//method_annotations

	    return (CDexParameterAnnotation*)p;
}
				
void CDexAnnotationsdirectoryItem::print()
{
	printf("\nClass annotations off:%08x",class_annotations_off);
	printf("\nFields size:%08x",fields_size);
	printf("\nMethods size:%08x",methods_size);
	printf("\nParameters size:%08x",parameters_size);
	char * p=(char*)(this+1);
	printf("Field annotations:");
	int _fields_size=GetFieldsSize();
	for(int i=0;i<_fields_size;i++){
		((CDexFieldAnnotation *)p)->print();
		p+=((CDexFieldAnnotation *)p)->Size();
	}
	printf("Method annotations:");
	int _methods_size=GetMethodsSize();
	for(int i=0;i<_methods_size;i++){
		((CDexMethodAnnotation *)p)->print();
		p+=((CDexMethodAnnotation *)p)->Size();
	}
	printf("Parameter annotations:");
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		((CDexParameterAnnotation *)p)->print();
		p+=((CDexParameterAnnotation *)p)->Size();
	}

}
				
int CDexAnnotationsdirectoryItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Class annotations off:%08x",class_annotations_off);
	len+=sprintf(buffer+len,"Fields size:%08x",fields_size);
	len+=sprintf(buffer+len,"Methods size:%08x",methods_size);
	len+=sprintf(buffer+len,"Parameters size:%08x",parameters_size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"Field annotations:");
	int _fields_size=GetFieldsSize();
	for(int i=0;i<_fields_size;i++){
		len+=((CDexFieldAnnotation *)p)->sprint(buffer+len);
		p+=((CDexFieldAnnotation *)p)->Size();
	}
	len+=sprintf(buffer+len,"Method annotations:");
	int _methods_size=GetMethodsSize();
	for(int i=0;i<_methods_size;i++){
		len+=((CDexMethodAnnotation *)p)->sprint(buffer+len);
		p+=((CDexMethodAnnotation *)p)->Size();
	}
	len+=sprintf(buffer+len,"Parameter annotations:");
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		len+=((CDexParameterAnnotation *)p)->sprint(buffer+len);
		p+=((CDexParameterAnnotation *)p)->Size();
	}

	return len;
}
				
int CDexAnnotationsdirectoryItem::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _fields_size=GetFieldsSize();
	for(int i=0;i<_fields_size;i++){
		len+=((CDexFieldAnnotation *)p)->Size();
		p+=((CDexFieldAnnotation *)p)->Size();
	}
	int _methods_size=GetMethodsSize();
	for(int i=0;i<_methods_size;i++){
		len+=((CDexMethodAnnotation *)p)->Size();
		p+=((CDexMethodAnnotation *)p)->Size();
	}
	int _parameters_size=GetParametersSize();
	for(int i=0;i<_parameters_size;i++){
		len+=((CDexParameterAnnotation *)p)->Size();
		p+=((CDexParameterAnnotation *)p)->Size();
	}

	return len;
}
				
void CDexFieldAnnotation::print()
{
	printf("\nField idx:%08x",field_idx);
	printf("\nAnnotations off:%08x",annotations_off);

}
				
int CDexFieldAnnotation::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Field idx:%08x",field_idx);
	len+=sprintf(buffer+len,"Annotations off:%08x",annotations_off);

	return len;
}
				
int CDexFieldAnnotation::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexMethodAnnotation::print()
{
	printf("\nMethod idx:%08x",method_idx);
	printf("\nAnnotations off:%08x",annotations_off);

}
				
int CDexMethodAnnotation::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Method idx:%08x",method_idx);
	len+=sprintf(buffer+len,"Annotations off:%08x",annotations_off);

	return len;
}
				
int CDexMethodAnnotation::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
				
void CDexParameterAnnotation::print()
{
	printf("\nMethod idx:%08x",method_idx);
	printf("\nAnnotations off:%08x",annotations_off);

}
				
int CDexParameterAnnotation::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Method idx:%08x",method_idx);
	len+=sprintf(buffer+len,"Annotations off:%08x",annotations_off);

	return len;
}
				
int CDexParameterAnnotation::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//elements of the list
CDexAnnotationsetrefItem* CDexAnnotationsetrefList::GetList()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexAnnotationsetrefItem*)p;
}
				
void CDexAnnotationsetrefList::print()
{
	printf("\nSize:%08x",size);
	char * p=(char*)(this+1);
	printf("List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexAnnotationsetrefItem *)p)->print();
		p+=((CDexAnnotationsetrefItem *)p)->Size();
	}

}
				
int CDexAnnotationsetrefList::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Size:%08x",size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"List:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationsetrefItem *)p)->sprint(buffer+len);
		p+=((CDexAnnotationsetrefItem *)p)->Size();
	}

	return len;
}
				
int CDexAnnotationsetrefList::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationsetrefItem *)p)->Size();
		p+=((CDexAnnotationsetrefItem *)p)->Size();
	}

	return len;
}
//elements of the set. The elements must be sorted in increasing order, by type_idx.
CDexAnnotationoffItem* CDexAnnotationsetrefItem::GetEntries()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexAnnotationoffItem*)p;
}
				
void CDexAnnotationsetrefItem::print()
{
	printf("\nAnnotations off:%08x",annotations_off);
	printf("\nSize:%08x",size);
	char * p=(char*)(this+1);
	printf("Entries:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		((CDexAnnotationoffItem *)p)->print();
		p+=((CDexAnnotationoffItem *)p)->Size();
	}

}
				
int CDexAnnotationsetrefItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Annotations off:%08x",annotations_off);
	len+=sprintf(buffer+len,"Size:%08x",size);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"Entries:");
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationoffItem *)p)->sprint(buffer+len);
		p+=((CDexAnnotationoffItem *)p)->Size();
	}

	return len;
}
				
int CDexAnnotationsetrefItem::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	int _size=GetSize();
	for(int i=0;i<_size;i++){
		len+=((CDexAnnotationoffItem *)p)->Size();
		p+=((CDexAnnotationoffItem *)p)->Size();
	}

	return len;
}
				
void CDexAnnotationoffItem::print()
{
	printf("\nAnnotation off:%08x",annotation_off);

}
				
int CDexAnnotationoffItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Annotation off:%08x",annotation_off);

	return len;
}
				
int CDexAnnotationoffItem::Size()
{
	int len;
	len=sizeof(*this);

	return len;
}
//encoded annotation contents, in the format described by "encoded_annotation Format" under "encoded_value Encoding" above.
CDexEncodedAnnotation* CDexAnnotationItem::GetAnnotation()

{
	      char*p=(char*)(this+1);      	
	

	    return (CDexEncodedAnnotation*)p;
}
				
void CDexAnnotationItem::print()
{
	printf("\nVisibility:%02x",visibility);
	char * p=(char*)(this+1);
	printf("Annotation:");
	((CDexEncodedAnnotation *)p)->print();//annotation

}
				
int CDexAnnotationItem::sprint(char * buffer)
{
	int len=0;
	len+=sprintf(buffer+len,"Visibility:%02x",visibility);
	char * p=(char*)(this+1);
	len+=sprintf(buffer+len,"Annotation:");
	len+=((CDexEncodedAnnotation *)p)->sprint(buffer+len);//annotation

	return len;
}
				
int CDexAnnotationItem::Size()
{
	int len;
	len=sizeof(*this);
	char * p=(char*)(this+1);
	len+=((CDexEncodedAnnotation *)p)->Size();//annotation

	return len;
}
//bytes representing the encoded array value, in the format specified by "encoded_array Format" under "encoded_value Encoding" above.
CDexEncodedArray* CDexEncodedarrayItem::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexEncodedArray*)p;
}
				
void CDexEncodedarrayItem::print()
{
	char * p=&dummy;
	printf("Value:");
	((CDexEncodedArray *)p)->print();//value

}
				
int CDexEncodedarrayItem::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	len+=((CDexEncodedArray *)p)->sprint(buffer+len);//value

	return len;
}
				
int CDexEncodedarrayItem::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexEncodedArray *)p)->Size();//value

	return len;
}
//the default bindings for this annotation, represented as an annotation of this type. The annotation need not include all names defined by the annotation; missing names simply do not have defaults.
CDexAnnotation* CDexDalvikannotationAnnotationDefault::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexAnnotation*)p;
}
				
void CDexDalvikannotationAnnotationDefault::print()
{
	char * p=&dummy;
	printf("Value:");
	((CDexAnnotation *)p)->print();//value

}
				
int CDexDalvikannotationAnnotationDefault::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	len+=((CDexAnnotation *)p)->sprint(buffer+len);//value

	return len;
}
				
int CDexDalvikannotationAnnotationDefault::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexAnnotation *)p)->Size();//value

	return len;
}
//the class which most closely lexically scopes this class
CDexClass* CDexDalvikannotationEnclosingclass::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexClass*)p;
}
				
void CDexDalvikannotationEnclosingclass::print()
{
	char * p=&dummy;
	printf("Value:");
	((CDexClass *)p)->print();//value

}
				
int CDexDalvikannotationEnclosingclass::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	len+=((CDexClass *)p)->sprint(buffer+len);//value

	return len;
}
				
int CDexDalvikannotationEnclosingclass::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexClass *)p)->Size();//value

	return len;
}
//the method which most closely lexically scopes this class
CDexMethod* CDexDalvikannotationEnclosingmethod::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexMethod*)p;
}
				
void CDexDalvikannotationEnclosingmethod::print()
{
	char * p=&dummy;
	printf("Value:");
	((CDexMethod *)p)->print();//value

}
				
int CDexDalvikannotationEnclosingmethod::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	len+=((CDexMethod *)p)->sprint(buffer+len);//value

	return len;
}
				
int CDexDalvikannotationEnclosingmethod::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexMethod *)p)->Size();//value

	return len;
}
//the originally declared simple name of this class (not including any package prefix). If this class is anonymous, then the name is null.
CDexString* CDexDalvikannotationInnerclass::GetName()

{
	      char*p=&dummy;      	
	

	    return (CDexString*)p;
}
//the originally declared access flags of the class (which may differ from the effective flags because of a mismatch between the execution models of the source language and target virtual machine)
int CDexDalvikannotationInnerclass::GetAccessflags()

{
	      char*p=&dummy;      	
	
		p+=((CDexString *)p)->Size();//name

	    return ((CDexInt*)p)->value;
}
				
void CDexDalvikannotationInnerclass::print()
{
	char * p=&dummy;
	printf("Name:");
	((CDexString *)p)->print();//name
	p+=((CDexString *)p)->Size();
	printf("Accessflags:");
	((CDexInt *)p)->print();//accessFlags

}
				
int CDexDalvikannotationInnerclass::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Name:");
	len+=((CDexString *)p)->sprint(buffer+len);//name
	p+=((CDexString *)p)->Size();
	len+=sprintf(buffer+len,"Accessflags:");
	len+=((CDexInt *)p)->sprint(buffer+len);//accessFlags

	return len;
}
				
int CDexDalvikannotationInnerclass::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	len+=((CDexString *)p)->Size();//name
	len+=((CDexInt *)p)->Size();//accessFlags

	return len;
}
//array of the member classes
CDexClass* CDexDalvikannotationMemberclasses::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexClass*)p;
}
				
void CDexDalvikannotationMemberclasses::print()
{
	char * p=&dummy;
	printf("Value:");
	//FIXME: no size for array

}
				
int CDexDalvikannotationMemberclasses::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	//FIXME: no size for array

	return len;
}
				
int CDexDalvikannotationMemberclasses::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	//FIXME: no size for array

	return len;
}
//the signature of this class or member, as an array of strings that is to be concatenated together
CDexString* CDexDalvikannotationSignature::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexString*)p;
}
				
void CDexDalvikannotationSignature::print()
{
	char * p=&dummy;
	printf("Value:");
	//FIXME: no size for array

}
				
int CDexDalvikannotationSignature::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	//FIXME: no size for array

	return len;
}
				
int CDexDalvikannotationSignature::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	//FIXME: no size for array

	return len;
}
//the array of exception types thrown
CDexClass* CDexDalvikannotationThrows::GetValue()

{
	      char*p=&dummy;      	
	

	    return (CDexClass*)p;
}
				
void CDexDalvikannotationThrows::print()
{
	char * p=&dummy;
	printf("Value:");
	//FIXME: no size for array

}
				
int CDexDalvikannotationThrows::sprint(char * buffer)
{
	int len=0;
	char * p=&dummy;
	len+=sprintf(buffer+len,"Value:");
	//FIXME: no size for array

	return len;
}
				
int CDexDalvikannotationThrows::Size()
{
	int len;
	len=0;
	char * p=&dummy;
	//FIXME: no size for array

	return len;
}
